package cn.serenedream.housedecoration.dto;

import cn.serenedream.housedecoration.entity.SaleProducts;
import cn.serenedream.housedecoration.entity.User;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;

import java.util.ArrayList;
import java.util.List;

public class SaleDTO {
    @NotBlank(message = "客户不得为空")
    private String id;
    @NotBlank(message = "客户不得为空")
    private User user;
    @NotBlank(message = "销售产品不得为空")
    private List<SaleProducts> saleProducts = new ArrayList<>();
    @NotBlank(message = "总金额不得为空")
    @Pattern(regexp = "\\d{0,}\\.\\d{2}", message = "金额格式不正确")
    private Double price;


    public SaleDTO() {
    }

    public SaleDTO(String id, User user, List<SaleProducts> saleProducts, Double price) {
        this.id = id;
        this.user = user;
        this.saleProducts = saleProducts;
        this.price = price;
    }

    /**
     * 获取
     * @return id
     */
    public String getId() {
        return id;
    }

    /**
     * 设置
     * @param id
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * 获取
     * @return user
     */
    public User getUser() {
        return user;
    }

    /**
     * 设置
     * @param user
     */
    public void setUser(User user) {
        this.user = user;
    }

    /**
     * 获取
     * @return saleProducts
     */
    public List<SaleProducts> getSaleProducts() {
        return saleProducts;
    }

    /**
     * 设置
     * @param saleProducts
     */
    public void setSaleProducts(List<SaleProducts> saleProducts) {
        this.saleProducts = saleProducts;
    }

    /**
     * 获取
     * @return price
     */
    public Double getPrice() {
        return price;
    }

    /**
     * 设置
     * @param price
     */
    public void setPrice(Double price) {
        this.price = price;
    }

    public String toString() {
        return "SaleDTO{id = " + id + ", user = " + user + ", saleProducts = " + saleProducts + ", price = " + price + "}";
    }
}